package nc.ui.hr.comp.pf.action;

import nc.ui.hr.comp.pf.PFApproveUI;
import nc.ui.hr.comp.pf.PFDataModel;
import nc.ui.hr.frame.FrameUI;
import nc.ui.hr.frame.action.AbstractAction;
import nc.ui.hr.frame.impl.MainBillMgrPanel;
import nc.ui.hr.frame.model.DataModel;
import nc.ui.hr.frame.util.BillPanelUtils;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillItem;
import nc.ui.pub.bill.BillModel;
import nc.vo.hr.comp.pf.PFConfig;
import nc.vo.hr.tools.pub.HRAggVO;
import nc.vo.pub.SuperVO;

public class PFAddAction extends AbstractAction
{
  private PFDataModel dataModel = (PFDataModel)getDataModel();
  


  private SuperVO headVO;
  

  private HRAggVO hrAggVO;
  


  public PFAddAction(FrameUI frameUI)
  {
    super(frameUI);
  }
  






  public PFAddAction(FrameUI frameUI, String checkClassMethod)
  {
    super(frameUI, checkClassMethod);
  }
  




  @SuppressWarnings("restriction")
public void execute()
    throws Exception
  {
    MainBillMgrPanel mainPanel = (MainBillMgrPanel)getMainPanel();
    
    this.hrAggVO = new HRAggVO();
    
    this.headVO = this.dataModel.getDefaultHeadVO(mainPanel);
    
    this.hrAggVO.setParentVO(this.headVO);
    
    mainPanel.show("CARD_PANEL");
    mainPanel.setData(this.hrAggVO);
    
    mainPanel.getBillCardPanel().getBillModel().setEnabled(false);
    
    getDataModel().setCurrentState(4);
    getDataModel().setCurrentState(2);
    

    if ((getFrameUI() instanceof PFApproveUI))
    {
      mainPanel.getBillCardPanel().getHeadItem(this.dataModel.getPFConfig().getBillCodeFieldCode()).setEdit(false);
    }
    else
    {
      mainPanel.getBillCardPanel().getHeadItem(this.dataModel.getPFConfig().getBillCodeFieldCode()).setEdit(!this.dataModel.isAutoGenerateBillCode());
    }
    

    BillPanelUtils.showBodyColum(mainPanel.getBillCardPanel(), this.dataModel.getPrintSubNotAllFieldCode(), false);
    
    mainPanel.getBillCardPanel().hideBodyTableCol("isapproved");
  }
}
